<?php
/**
 * User: taodf
 * Date: 17-4-29
 * Time: 下午8:32
 */

namespace Zeus\Routing;

/**
 * 不同路由引擎的对接接口
 *
 * Interface RouterInterface
 * @package Zeus\Routing
 */
interface RouterInterface
{
    /**
     * 向路由引擎中注册路由
     *
     * @param string|array $method
     * @param string $url
     * @param callable $callable
     */
    public function register($method, $url, $callable);

    /**
     * 注册GET方法路由
     *
     * @param string $url
     * @param callable $callable
     */
    public function get($url, $callable);

    /**
     * 注册POST方法路由
     *
     * @param string $url
     * @param callable $callable
     */
    public function post($url, $callable);

    /**
     * 注册PUT方法路由
     *
     * @param string $url
     * @param callable $callable
     */
    public function put($url, $callable);
    /**
     * 注册PATCH方法路由
     *
     * @param string $url
     * @param callable $callable
     */
    public function patch($url, $callable);

    /**
     * 注册DELETE方法路由
     *
     * @param string $url
     * @param callable $callable
     */
    public function delete($url, $callable);

    /**
     * 注册HEAD方法路由
     *
     * @param string $url
     * @param callable $callable
     */
    public function head($url, $callable);

    /**
     * 路由的分组注册
     *
     * @param string $prefix
     * @param $callable
     * @return mixed
     */
    public function group($prefix, $callable);

    /**
     * 根据请求，分发路由
     *
     * @param \Zeus\Http\Request $request
     * @param callable $handler
     * @return mixed
     */
    public function dispatch($request, $handler);
}